//引入请求函数
import request from "@/utils/request.js"


//用户账号密码登录api
export const reqUserLoginByAccount = (data) => {
    return request({
        url:"/api/u/loginByJson",
        method:"post",
        data
    })
}

//用户通过手机验证码登录
export const reqUserLoginByMobile = (data) => {
    return request({
        url:"/api/u/loginByMobile",
        method:"post",
        data
    })
}

//发送注册或登录验证码
export function reqPhoneCode(params){
    return request({
        url:"/api/sms/sendRegisterOrLoginCaptcha",
        method:"get",
        params
    })
}

//注册用户(手机号和验证码)
export const reqRegisterUser = (data)=>{
    return request({
        url:"/api//member/register",
        method:"post",
        data
    })
}

//创建临时token，防止重复提交
export const createTempToken = () => {
    return request({
        url:"/api/token/createToken",
        method:"get"
    })
}

//获取登录用户个人信息
export const reqUserInfo = (params) => {
    return request({
        url:"/api/member/getInfo",
        method:"get",
        params
    })
}

//用户退出登录
export const reqUserLogout = () => {
    return request({
        url:"/api/u/logout",
        method:"get",
    })
}